﻿<UserControl x:Class="MetaTracker.View.UserSelectionView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:converters="clr-namespace:MetaTracker.Converters"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="430" d:DesignWidth="441">
    <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
        <TextBlock Text="Welcome to the MetaTracker!" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,5"/>
        <TextBlock Width="300" TextWrapping="Wrap" HorizontalAlignment="Center"
                   Text="If this is your first time using Metatracker, please create a new user, so that we may securely store your service credentials."
                   Visibility="{Binding IsLoggedOn, Converter={StaticResource BoolToVisible}, Mode=OneWay}"/>
    <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
        
        <TextBlock HorizontalAlignment="Center" Margin="0,35,0,15"  
                   TextAlignment="Center"
                   Width="200" TextWrapping="Wrap"
                   Text="{Binding LoginMessage, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <TextBlock  Visibility="{Binding IsLoggedOn, Converter={StaticResource BoolToVisible}, Mode=OneWay}" 
                        Grid.Column="0" Grid.Row="0" Text="User Name: "/>
            <TextBox    Visibility="{Binding IsLoggedOn, Converter={StaticResource BoolToVisible}}" 
                        Grid.Column="1" Grid.Row="0" Width="150" 
                        Text="{Binding UserName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
            <TextBlock   Visibility="{Binding IsLoggedOn, Converter={StaticResource BoolToVisible}}"
                         Grid.Column="0" Grid.Row="1" Text="Password: "/>
            <PasswordBox Visibility="{Binding IsLoggedOn, Converter={StaticResource BoolToVisible}}"
                         Grid.Column="1" Grid.Row="1" Width="150" Name="passwordBox"/>
        </Grid>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
            <Button Width="70" Content="_Clear" Margin="0,0,25,0" Command="{Binding ClearFieldsCommand}"
                    Visibility="{Binding IsLoggedOn, Converter={StaticResource BoolToCollapsed}}"/>
            <Button Width="70" Content="{Binding LogonButtonText}" Command="{Binding ToggleLoginCommand}"/>
            
        </StackPanel>
        
        <Button Width="125" Margin="0,35,0,0" Content="Add New User"
                Command="{Binding AddNewUserCommand}"
                Visibility="{Binding IsLoggedOn, Converter={StaticResource BoolToCollapsed}}"/>
        <TextBlock Margin="0,30,0,0" HorizontalAlignment="Center">           
            <Hyperlink NavigateUri="http://platform.fatsecret.com" 
                       RequestNavigate="Hyperlink_RequestNavigate">
                Powered by FatSecret
            </Hyperlink>
        </TextBlock>
    </StackPanel>
    </StackPanel>
</UserControl>
